package com.xxzuibang.day16.stringbuffer类;

import java.util.Scanner;

public class StringBufferTest {
    public static void main(String[] args) {
        //输入一个价格，小数点前每三位添加一个","
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入一个价格：");
        String price = sc.next();
        StringBuffer sb=new StringBuffer(price);
        for(int i=sb.lastIndexOf(".")-3;i>0;i-=3){
            sb=sb.insert(i,",");
        }
        System.out.println(sb);


    }
}
